import sys
import json
sys.path.append('/data/snmonitor')
# sys.path.append('E:\\snmonitor')
# from flask import Flask
from flask import Flask, render_template, Response, json, jsonify
from src.core import selectInterface
# import jinja2
#
app = Flask(__name__)

# class MyRoute:
# def rout(self):
@app.route("/monitor", methods=['GET'])
def test():
    return "hello"

@app.route("/monitor/cpu", methods=['GET'])
def cpus():
    status = selectInterface.selectCpu()
    return Response(json.dumps(status), mimetype='application/json')
    # return jsonify(status)

@app.route("/monitor/mem", methods=['GET'])
def mem():
    status = selectInterface.selectMem()
    return jsonify(status)

@app.route("/monitor/disk", methods=['GET'])
def disk():
    status = selectInterface.selectDisk()
    return jsonify(status)
